polywirelessfandomcom-20200214-history
Ns3 on VirtualBox
Navigation: Main > ns3 > virtual box setup = Overview = We reviews all the steps to set up the ns-3 emulation in a virtual Linux machine on your Windows or MAC computer. A similar procedure can be used to set up a native Ubuntu machine. The virtual machine will let you run the ns-3 code, but not in real-time. You can use this mode for development and transfer the final code to the actual testbed later. The main steps are: * Ubuntu “Lucid Linx” in VirtualBox * Eclipse IDE + C++ Dev Tools * ns-3 network simulator * Linux containers (LXCs) * MPI = Installation Steps = Installing an Ubuntu Guest on a Windows Host in VirtualBox # Download required installation files: #* Oracle VirtualBox Windows #* Ubuntu “Lucid Linux” Desktop Edition iso #*Select your architecture (32-bit/64-bit) and latest version and download # Run the VirtualBox installer and install all necessary software and drivers # Create a new virtual machine: Open the VirtualBox Manager that you installed and select Machine > New. Select Next in the Create New Virtual Machine wizard. Under Name, type Ubuntu and make sure that Linux and Ubuntu are selected for Operating System and Version, respectively. Click Next. #*In the Memory dialog, set the Base Memory Size to around half of your system’s total physical memory (e.g. for 4GB of physical, enter 2048MB). This can be adjusted later. Next. #*Under Virtual Hard Disk, leave defaults and click Next. Click Next #*In the Create New Virtual Disk wizard, click next. Under Hard Disk Storage Type, leave defaults and click Next. #*Under Virtual Disk Location and Size, enter some reasonable size for the virtual disk image (e.g. 16GBs). Click Next and then Finish on the next screen then Finish again in the Summary dialog. #*Note: The image file will only actually take up this much space when the VDI is full since it is “dynamically expanding.” #Install the Ubuntu guest: #*In VirtualBox Manager, right click the VM you just created (Ubuntu) and select Start. #*In the First Run Wizard, click Next. Under Select Installation Media, click the folder icon next to the Media Source drop menu. Browse to where you downloaded the Ubuntu iso file and open it. Next then Finish. #*A new window should appear with the Ubuntu installer booting up in the VM. Select Install Ubuntu 10.x from in the first dialog. #*United States (New York) should be selected for the Time Zone. Forward. The Keyboard Layout should be USA. Forward. #*Under Prepare Disk Space, leave defaults. Forward. #*Under Who Are You, enter and username, password and hostname. Next and Install on the following screen. Wait for installation to finish and click Restart Now when prompted. #*Your fresh install will boot up. Login to your user account. Almost immediately the Update Manager should appear. Go ahead and Install Updates. #Install VirtualBox Guest Additions and set up shared folders #*The Guest Additions tools enable improved graphics features/”seamless mode” and shared folders for accessing your Windows filesystem from inside the VM. #*With your Ubuntu VM started, select Devices > Install Guest Additions in the VM window. #*Open the VBOXADDITIONS_4.x.x_etc mount from the Places menu. Copy the file VBoxLinuxAdditions.run from this directory to your desktop. #*Open a new terminal from Applications > Accessories > Terminal. You may want to create a shortcut to the Terminal on your desktop (just drag and drop it from Accessories) for later. #*In the terminal, type the following (case-sensitive) commands to install Guest Additions #:Note: press tab to autocomplete a partially-typed command, directory, or filename or double tab for options): #*:cd ~/Desktop Changes the directory to /home/your_username/Desktop ( ‘~’ means your home directory) #*:chmod +x ./VBoxLinuxAdditions.run Sets the installer as executable #*:sudo. ./VBoxLinuxAdditions.run Runs the installer in superuser mode (sudo). ‘./’ means run from the current directory. Wait for the installation to finish. #*Now we will set up a shared folder to access your Windows files. #**From the VM window, select Devices > Shared Folders. #**In the window that comes up, click the folder icon with the plus symbol. #**In the Add Share window under Folder Path, type Windows directory you want to share (e.g. to share your C drive, enter C:\). Enter the Linux Folder Name (it may automatically choose C_DRIVE, which is fine). Also select Make Permanent only. Click OK. #**Next we will configure the shared folder to be mounted automatically. #**In the terminal, type: #* #*:sudo mkdir /media/C_DRIVE Makes a directory where the share is to be mounted #*:sudo gedit /etc/fstab Opens the fstab file in the graphical editor #*In Gedit, copy and append the following line at the end of the file: #*:C_DRIVE /media/ C_DRIVE vboxsf defaults 0 0 #**Save the file and quit Gedit. #*Restart the VM (type sudo reboot in the terminal). Once you log back in, you can optionally create a symlink (shortcut) to the shared folder in your home directory: #*:ln –s /media/C_DRIVE ~/C_DRIVE Installing the development environment with ns-3 For the downloading and configuration procedures using the terminal, please refer to Ns-3 Configuration Using the Terminal; for those procedures using the Eclipse IDE, please refer to Ns-3 Configuration Using Eclipse. Setting up virtual networks in Linux containers http://www.nsnam.org/wiki/index.php/HOWTO_Use_Linux_Containers_to_set_up_virtual_networks Loading a VirtualBox Disk Image 1. Open VirtualBox Manager. Select Machine > New 2. Select Next on the first dialog. In the Create New Virtual Machine screen, type Maverick under Name. Note that the OS automatically changes to Ubuntu Linux. Click Next. 3. Set the base memory size to some fraction of your PC’s total resident memory. Next. 4. Under Virtual Hard Disk select Use existing hard disk. ''Now click the tiny little folder icon next to the drop menu and navigate to where you copied the ''Maverick.vdi on your drive. Load that file (not the .vbox file). Next. 5. Click ''Create ''on the last screen. Now you should see the VM listed in the manager window. If all went well, you should be able to click Start and boot into your Ubuntu Server environment.